<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <script>
        class Animal {
            constructor(type) {
                this.type = type;
            }
            run() {
                console.log("动物都会跑");
            }
        }

        class Dog extends Animal {
            constructor(type, name) {
                super(type);
                // super的意思是调用父类的构造函数 因为super所以有的时候父类也叫超类
                this.name = name;
            }
            wang() {
                console.log("狗会汪汪叫");
            }
        }

        let xiaohuang = new Dog("小狗", "小黄");
        console.log(xiaohuang.type);
        xiaohuang.run()
    </script>
</body>

</html>

</html>